<!doctype html>
<html lang="zh-CN" th:replace="admin-layout-default :: layout(~{::title}, ~{}, ~{::script}, ~{::body})"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <title>选择试题列表</title>
    <script>
        var $table = $("#table");
        var $search = $("#searchBtn");
        var selections = [];
        var rows = [];
        var type = parent.$("#type").val();

        //$(this).serialize()
        $(function () {
            initTable($table, [{
                checkbox: true,
            }, {
                field: 'content',
                title: '试题内容',
            }], function () {
                // $remove.prop('disabled', !$table.bootstrapTable('getSelections').length);
                // $update.prop('disabled', !$table.bootstrapTable('getSelections').length);
                // $info.prop('disabled', !$table.bootstrapTable('getSelections').length);
                // $question.prop('disabled', !$table.bootstrapTable('getSelections').length);
                // $user.prop('disabled', !$table.bootstrapTable('getSelections').length);
                // $preview.prop('disabled', !$table.bootstrapTable('getSelections').length);
                // $copy.prop('disabled', !$table.bootstrapTable('getSelections').length);

                selections = getIdSelections()
            })
        })

        function getIdSelections() {
            return $.map($table.bootstrapTable('getSelections'), function (row) {
                return row.id
            })
        }

        $search.click(function () {
            $table.bootstrapTable('refresh')
        })
    </script>
</head>
<body>
<form id="toolbar" class="fyl-mb10">
    <input type="hidden" name="type" th:value="${type}">
    <input type="hidden" name="paperId" th:value="${paperId}">
    <div class="row">
        <div class="col-md-3 fyl-mb10">
            <input type="text" class="form-control fyl-clear" name="content"
                   placeholder="试题内容">
        </div>
        <div class="col-md-4 fyl-mb10">
            <a href="javascript:void(0)" class="btn btn-primary" id="searchBtn">查询</a>
            <a href="javascript:void(0)" class="btn btn-warning" id="clearSearchBtn">清空</a>
        </div>
    </div>
</form>
<table id="table" data-url="/admin/paperQuestion/ajax/select/question/list"></table>
</body>
</html>